//
//  ZMissionRemarksVC.m
//  WeClubs
//
//  Created by 花花 on 2017/6/26.
//  Copyright © 2017年 Zed. All rights reserved.
//

#import "ZMissionRemarksVC.h"
#import "ZNewTextViewCell.h"
#import "ZNewMissionVC.h"
@interface ZMissionRemarksVC ()<UITableViewDataSource,UITableViewDelegate>
//tableView
@property(nonatomic)UITableView *tableView;

@property(nonatomic,copy)NSString *content;
@end

static NSString *const ZMissionRemarksCellID = @"ZMissionRemarksCellID";
@implementation ZMissionRemarksVC

#pragma mark - Life Cycle
- (void)viewDidLoad {
    [super viewDidLoad];
   
    [self.view addSubview:self.tableView];
}

- (void)zConfigNavigation
{
    [super zConfigNavigation];
    
    [self zAddBackItemWithGesture:YES];
    self.navigationItem.title = @"任务备注";
    self.navigationItem.rightBarButtonItem = [self zNavItemWithTitle:@"确定" andSelector:@selector(navRightOnClick)];

}
-(UITableView *)tableView{
    
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,64, Z_SCREEN_WIDTH, Z_SCREEN_HEIGHT-64) style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        [_tableView setBackgroundColor:GENERAL_VIEW_BG_COLOR];
    
        _tableView.rowHeight = 200;
        [_tableView registerNib:[UINib nibWithNibName:@"ZNewTextViewCell" bundle:nil] forCellReuseIdentifier:ZMissionRemarksCellID];
    }
    return _tableView;
}

- (void)navRightOnClick{
    
    ZLog(@"%s",__func__);
    
    
    for (ZNewMissionVC *tempVC in self.navigationController.viewControllers) {
        if ([tempVC isKindOfClass:[ZNewMissionVC class]]) {
            
            tempVC.content = self.content;
            
            [self.navigationController popToViewController:tempVC animated:YES];
            
        }
    }
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    Z_WEAK_SELF;
    ZNewTextViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ZMissionRemarksCellID];
    [cell setPlaceHolderText:@"请输入任务备注......"];
    cell.textViewTextHandlerCallBack = ^(NSString * textF){
        weakSelf.content = textF;
        
    };
    return cell;
}







@end
